//
// Created by Administrator on 2021/9/16.
//
#include <stdio.h>
#include <stdbool.h>
#include "task1.h"

void task6(){
    initRandSeed();
    int right = 0,wrong = 0;
    do {
        int remain_question = 10;
        while (remain_question--) {
            int num1 = getRandNum();
            char op = getRandOp();
            int num2 = getRandNum();
            int answer = 0;
            switch (op) {
                case '+': {
                    answer = num1 + num2;
                    break;
                }
                case '-': {
                    answer = num1 - num2;
                    break;
                }
                case '*': {
                    answer = num1 * num2;
                    break;
                }
                case '/': {
                    answer = num1 / num2;
                    break;
                }
            }

            printf("%d %c %d = ?", num1, op, num2);
            int stu_answer;
            scanf("%d", &stu_answer);
            if (stu_answer == answer) {
                switch (getRandNum()%4) {
                    case 0:{printf("Very good!\n");break;}
                    case 1:{printf("Excellent!\n");break;}
                    case 2:{printf("Nice work!\n");break;}
                    case 3:{printf("Keep up good work!\n");break;}
                }
                ++right;
            } else {
                switch (getRandNum()%4) {
                    case 0:{printf("No. Please tey again!\n");break;}
                    case 1:{printf("Wrong. Try once more!\n");break;}
                    case 2:{printf("Don't give up!\n");break;}
                    case 3:{printf("Not correct. Keep trying!\n");break;}
                }
                ++wrong;
            }
        }
        printf("right:%d, wrong:%d -> score = %d\n", right, wrong, right * 10);
    }while(right <= 7);
};